import re
import timeit

# 测试数据
text = "Hello, this is a simple 123 string for testing regular expressions and simple string matching."
pattern = "\d+"

# 先编译正则表达式，然后使用
compiled_pattern = re.compile(pattern)
ret = compiled_pattern.search(text)
print(ret)

""" 结果
<re.Match object; span=(24, 27), match='123'>
"""